package com.honeycomb.user.service.impl;

import java.util.Stack;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.honeycomb.common.PositionInfo;
import com.honeycomb.common.base.service.impl.BaseServiceImpl;
import com.honeycomb.db.dao.UserinfoDao;
import com.honeycomb.user.dto.UserLoginInfo;
import com.honeycomb.user.dto.UserinfoDto;
import com.honeycomb.user.service.UserService;

/**
 * 用户Service实现
 * 
 * @author Wangyu
 */
@Service
public class UserServiceImpl extends BaseServiceImpl implements UserService {

	@Resource
	private UserinfoDao userinfoDao;
	
	
	@Override
	public UserinfoDto doCheckUserIsLegal(UserLoginInfo loginInfo) {
		return userinfoDao.getUserByIdAndPwd(loginInfo);
	}

	@Override
	public UserinfoDto getUser(Long user_id) {
		return userinfoDao.getUser(user_id);
	}
	
	public boolean doCheckEmailAlreadyExist(String email){
		return userinfoDao.doCheckUserIdAlreadyExist(email);
	}

	@Override
	 public UserinfoDto doAddUserinfo(UserLoginInfo loginInfo, UserinfoDto userInfo) {
		return userinfoDao.doAdduserinfo(loginInfo, userInfo);
	}

	@Override
	public boolean doUpdate01(UserinfoDto user) {
		return userinfoDao.doUpdate01(user);
	}

	@Override
	public boolean doUpdate02(Long userId, UserLoginInfo loginInf) {
		return userinfoDao.doUpdate02(userId, loginInf);
	}

	@Override
	public void doAddPosition(Long userId, PositionInfo position) {
		userinfoDao.doAddPosition(userId, position);
	}
	
	public Stack<PositionInfo> getFavourPositions(Long userId) {
		return userinfoDao.getFavourPositions(userId);
	}
}
